package cn.edu.nwsuaf.studentcenter.pojo;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * StudentExamInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "student_exam_info", catalog = "exam")
public class StudentExamInfo implements java.io.Serializable {

	// Fields

	private StudentExamInfoId id;
	private ExamPaperInfo examPaperInfo;
	private Student student;

	// Constructors

	/** default constructor */
	public StudentExamInfo() {
	}

	/** full constructor */
	public StudentExamInfo(StudentExamInfoId id, ExamPaperInfo examPaperInfo,
			Student student) {
		this.id = id;
		this.examPaperInfo = examPaperInfo;
		this.student = student;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "studentNo", column = @Column(name = "student_no", nullable = false, length = 50)),
			@AttributeOverride(name = "examPaperNo", column = @Column(name = "exam_paper_no", nullable = false, length = 50)) })
	public StudentExamInfoId getId() {
		return this.id;
	}

	public void setId(StudentExamInfoId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "exam_paper_no", nullable = false, insertable = false, updatable = false)
	public ExamPaperInfo getExamPaperInfo() {
		return this.examPaperInfo;
	}

	public void setExamPaperInfo(ExamPaperInfo examPaperInfo) {
		this.examPaperInfo = examPaperInfo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "student_no", nullable = false, insertable = false, updatable = false)
	public Student getStudent() {
		return this.student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

}